﻿<b:BaseWindow x:Class="SaryaAccounting.MainWindowView"
              xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
              xmlns:my="clr-namespace:SaryaAccounting.ModuleMenu"
              xmlns:b="clr-namespace:Tanmia.Basis.Prism;assembly=Tanmia.Basis"
              xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
              xmlns:regions="http://www.codeplex.com/prism"
              regions:RegionManager.RegionName="WindowRegion" Style="{StaticResource WindowStyle}"
              Title="MainWindow" Height="410" Width="693">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="2" />
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="55" />
            <RowDefinition Height="1" />
            <RowDefinition Height="*" />
            <RowDefinition Height="35" />
        </Grid.RowDefinitions>

        <Grid Grid.Column="2" Grid.Row="0">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>
            <Label Content="{Binding ViewInfo.Title}" Grid.Column="0" VerticalContentAlignment="Center" FontFamily="Sakkal Majalla" FontSize="36" Foreground="#9F000000" />
            <Label Grid.Column="1" VerticalContentAlignment="Center">
                <TextBlock FontFamily="Tahoma" FontSize="11" Foreground="#BD003400" Text="{Binding ViewInfo.Description}" TextWrapping="Wrap" />
            </Label>
        </Grid>

        <Rectangle Grid.Column="2" Grid.Row="1" Grid.ColumnSpan="2" Height="1" Margin="5,0,5,0" Name="rectangle1" Stroke="{StaticResource LightBrush}" />

        <Border Name="CaptionBorder" Grid.Column="0" Grid.Row="0" Grid.RowSpan="3" HorizontalAlignment="Left" Margin="5,5,0,0" Width="30" 
                                CornerRadius="4,4,0,0" BorderThickness="1,1,1,0" BorderBrush="{StaticResource LightBrush}" Background="{StaticResource BackgroundLightBrush}" MouseLeftButtonDown="CaptionBorder_MouseLeftButtonDown">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="30" />
                    <ColumnDefinition Width="1" />
                    <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>

                <StackPanel Orientation="Vertical" VerticalAlignment="Bottom">
                    <Button x:Name="CloseButton" Width="20" Height="20" Margin="0,5,0,0" Focusable="False" Command="{Binding CloseCommand}">
                        <Button.Style>
                            <Style TargetType="{x:Type Button}">
                                <Setter Property="Template">
                                    <Setter.Value>
                                        <ControlTemplate TargetType="{x:Type Button}">
                                            <Grid Background="Transparent">
                                                <Border BorderThickness="1" Background="#00000000">
                                                    <Path x:Name="closePath" Width="10" Height="10" Data="M0.28710935,3.5868225 L1.3359375,3.5868225 L3.515625,6.7626038 L3.5390625,6.7626038 L5.7070313,3.5868225 L6.7675781,3.5868225 L4.1074219,7.4481506 L6.890625,11.426666 L5.8183594,11.426666 L3.5214844,8.1044006 L3.4980469,8.1044006 L1.2011719,11.426666 L0.11718747,11.426666 L2.9238281,7.4247131 z" Fill="{StaticResource LightBrush}" RenderTransformOrigin=".5,.5" Stretch="Fill">
                                                        <Path.RenderTransform>
                                                            <TransformGroup>
                                                                <ScaleTransform />
                                                                <SkewTransform />
                                                                <RotateTransform />
                                                                <TranslateTransform />
                                                            </TransformGroup>
                                                        </Path.RenderTransform>
                                                    </Path>
                                                </Border>
                                            </Grid>
                                            <ControlTemplate.Triggers>
                                                <Trigger Property="IsMouseOver" Value="True">
                                                    <Setter TargetName="closePath" Property="Fill" Value="#FFFFAF00"/>
                                                </Trigger>
                                            </ControlTemplate.Triggers>
                                        </ControlTemplate>
                                    </Setter.Value>
                                </Setter>
                            </Style>
                        </Button.Style>
                    </Button>

                    <ToggleButton x:Name="MaxAndNormalButton" Width="20" Height="20" Margin="0,7" Focusable="False" Checked="MaxAndNormalButton_Toggle" Unchecked="MaxAndNormalButton_Toggle">
                        <ToggleButton.Style>
                            <Style TargetType="{x:Type ToggleButton}">
                                <Setter Property="Template">
                                    <Setter.Value>
                                        <ControlTemplate TargetType="{x:Type ToggleButton}">
                                            <Grid Background="Transparent">
                                                <VisualStateManager.VisualStateGroups>
                                                    <VisualStateGroup x:Name="CommonStates">
                                                        <VisualState x:Name="Normal" />
                                                        <VisualState x:Name="MouseOver">
                                                            <Storyboard>
                                                                <ColorAnimationUsingKeyFrames Storyboard.TargetName="rect1" Storyboard.TargetProperty="(Shape.Stroke).(SolidColorBrush.Color)">
                                                                    <EasingColorKeyFrame KeyTime="0" Value="#FFB68211" />
                                                                </ColorAnimationUsingKeyFrames>
                                                                <ColorAnimationUsingKeyFrames Storyboard.TargetName="rect2" Storyboard.TargetProperty="(Shape.Stroke).(SolidColorBrush.Color)">
                                                                    <EasingColorKeyFrame KeyTime="0" Value="#FFB68211" />
                                                                </ColorAnimationUsingKeyFrames>
                                                                <ColorAnimationUsingKeyFrames Storyboard.TargetName="rect2" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)">
                                                                    <EasingColorKeyFrame KeyTime="0" Value="#FFB68211" />
                                                                </ColorAnimationUsingKeyFrames>
                                                                <ColorAnimationUsingKeyFrames Storyboard.TargetName="rect3" Storyboard.TargetProperty="(Shape.Stroke).(SolidColorBrush.Color)">
                                                                    <EasingColorKeyFrame KeyTime="0" Value="#FFB68211" />
                                                                </ColorAnimationUsingKeyFrames>
                                                                <ColorAnimationUsingKeyFrames Storyboard.TargetName="rect4" Storyboard.TargetProperty="(Shape.Stroke).(SolidColorBrush.Color)">
                                                                    <EasingColorKeyFrame KeyTime="0" Value="#FFB68211" />
                                                                </ColorAnimationUsingKeyFrames>
                                                            </Storyboard>
                                                        </VisualState>
                                                        <VisualState x:Name="Pressed" />
                                                        <VisualState x:Name="Disabled" />
                                                    </VisualStateGroup>
                                                    <VisualStateGroup x:Name="CheckStates">
                                                        <VisualState x:Name="Checked">
                                                            <Storyboard>
                                                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="canvas1" Storyboard.TargetProperty="(UIElement.Visibility)">
                                                                    <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Collapsed}" />
                                                                </ObjectAnimationUsingKeyFrames>
                                                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="canvas2" Storyboard.TargetProperty="(UIElement.Visibility)">
                                                                    <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}" />
                                                                </ObjectAnimationUsingKeyFrames>
                                                            </Storyboard>
                                                        </VisualState>
                                                        <VisualState x:Name="Unchecked" />
                                                        <VisualState x:Name="Indeterminate" />
                                                    </VisualStateGroup>
                                                </VisualStateManager.VisualStateGroups>
                                                <Border BorderThickness="1">
                                                    <Grid>
                                                        <Canvas x:Name="canvas1" Margin="3,3,3,3">
                                                            <Rectangle x:Name="rect1" Width="12" Height="12" Canvas.Left="0.011" Canvas.Top="0.066" Stroke="{StaticResource LightBrush}" />
                                                            <Rectangle x:Name="rect2" Width="12" Height="4" Stroke="{StaticResource LightBrush}" Fill="{StaticResource LightBrush}" />
                                                        </Canvas>
                                                        <Canvas x:Name="canvas2" Margin="3,3,3,3" Visibility="Collapsed">
                                                            <Rectangle x:Name="rect3" Width="8" Height="8" Canvas.Left="1" Canvas.Top="1" Stroke="{StaticResource LightBrush}" />
                                                            <Rectangle x:Name="rect4" Width="8" Height="8" Canvas.Left="3" Canvas.Top="3" Stroke="{StaticResource LightBrush}" />
                                                        </Canvas>
                                                    </Grid>
                                                </Border>
                                            </Grid>
                                        </ControlTemplate>
                                    </Setter.Value>
                                </Setter>
                            </Style>
                        </ToggleButton.Style>
                    </ToggleButton>

                    <Button x:Name="MinButton" Width="20" Height="20" Margin="0" Focusable="False" Click="MinButton_Click">
                        <Button.Style>
                            <Style TargetType="{x:Type Button}">
                                <Setter Property="Template">
                                    <Setter.Value>
                                        <ControlTemplate TargetType="{x:Type Button}">
                                            <Grid Background="Transparent">
                                                <Border BorderThickness="0" />
                                                <Rectangle x:Name="minRect" Height="2" RadiusX=".5" RadiusY=".5" Fill="{StaticResource LightBrush}" Margin="1,5" />
                                            </Grid>
                                            <ControlTemplate.Triggers>
                                                <Trigger Property="IsMouseOver" Value="True">
                                                    <Setter Property="Fill" TargetName="minRect" Value="#FFB58110"/>
                                                </Trigger>
                                            </ControlTemplate.Triggers>
                                        </ControlTemplate>
                                    </Setter.Value>
                                </Setter>
                            </Style>
                        </Button.Style>
                    </Button>
                </StackPanel>

                <Rectangle Grid.Column="1" Stroke="{StaticResource LightBrush}" />

                <my:ModuleNavigatorControl Grid.Column="2" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
            </Grid>
        </Border>

        <TabControl Grid.Column="2" Grid.Row="2" Name="MainRegion" Margin="5" 
                    regions:RegionManager.RegionName="MainRegion" HorizontalAlignment="Stretch"  VerticalAlignment="Stretch">
            <!--<TabItem Header="استعراض الفروع" IsSelected="True"></TabItem>
            <TabItem Header="استعراض المواد" IsSelected="False"></TabItem>-->
        </TabControl>

        <ToggleButton x:Name="OperationsMenuButton" Width="20" Margin="10,13,0,22" Focusable="False" Height="20" HorizontalAlignment="Left">
            <ToggleButton.Triggers>
                <EventTrigger SourceName="OperationsMenuButton" RoutedEvent="ToggleButton.Checked">
                    <BeginStoryboard>
                        <Storyboard>
                            <DoubleAnimation Storyboard.TargetName="CaptionBorder" Storyboard.TargetProperty="(Border.Width)" Duration="00:00:01" To="200" />
                        </Storyboard>
                    </BeginStoryboard>
                </EventTrigger>
                <EventTrigger SourceName="OperationsMenuButton" RoutedEvent="ToggleButton.Unchecked">
                    <BeginStoryboard>
                        <Storyboard>
                            <DoubleAnimation Storyboard.TargetName="CaptionBorder" Storyboard.TargetProperty="(Border.Width)" Duration="00:00:01" To="30" />
                        </Storyboard>
                    </BeginStoryboard>
                </EventTrigger>
            </ToggleButton.Triggers>
            <ToggleButton.Style>
                <Style TargetType="{x:Type ToggleButton}">
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate TargetType="{x:Type ToggleButton}">
                                <Rectangle Fill="Beige" Stroke="{StaticResource LightBrush}" Width="10" Height="10" />
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>
            </ToggleButton.Style>
        </ToggleButton>

        <StatusBar Grid.Row="3" Grid.ColumnSpan="3" Margin="5,0,5,5">
            <StatusBarItem>
                <TextBlock x:Name="tbStatus" Text="Ready." />
            </StatusBarItem>
        </StatusBar>
    </Grid>
</b:BaseWindow>
